import java.util.Scanner;

//find number of zeroes in n!

public class FCTRL {

	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		int t = s.nextInt();
		while (t-- > 0) {
			int n = s.nextInt();

			int n5 = 0;
			while (n > 0) {
				n = n / 5;
				n5 = n5 + n;
			}
			
//			int n2 = 0;
//			while (n > 0) {
//				n = n / 2;
//				n2 = n2 + n;
//			}
//			System.out.println(Math.max(n5, n2));
			System.out.println(n5);
		}
		s.close();
	}

}
